def test_force_cancel_order():
    driver = webdriver.Chrome()
    login_admin(driver)  # 封装登录函数
    
    # 定位目标订单
    order_id = "ORD202311011235"
    driver.find_element(By.XPATH, f"//tr[td='{order_id}']//button[contains(@class,'action-menu')]").click()
    
    # 执行强制取消
    WebDriverWait(driver, 5).until(
        EC.element_to_be_clickable((By.XPATH, "//li[text()='强制取消']"))
    ).click()
    driver.find_element(By.NAME, "cancel_reason").send_keys("测试强制取消")
    driver.find_element(By.ID, "confirm-cancel").click()
    
    # 验证状态变更
    status = WebDriverWait(driver, 5).until(
        EC.visibility_of_element_located((By.XPATH, f"//tr[td='{order_id}']//span[@class='status cancelled']"))
    )
    assert "已取消" in status.text, "状态未更新"